import { Button, message } from 'antd';
import { useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';

function AddIssueButton() {
  const { isLogin } = useSelector((state) => state.user);
  const navigate = useNavigate();

  const gotoAddIssue = () => {
    if (!isLogin) {
      message.warning('请先登录');
      return;
    }
    navigate('/addIssue');
  };

  return (
    <Button type="primary" size='large' className="w-full" onClick={gotoAddIssue}>
      我要提问
    </Button>
  );
}

export default AddIssueButton;
